<template>
	<view class="container ptb_8 plr_16">
		<view class="height_104 ptb_18 box plr_16 br_8 fx aic jcb fc_fff"
			style="background: linear-gradient(180deg, #FD993C 0%, #FE5A1C 100%);">
			<view>
				<view>
					积分余额
				</view>
				<view class="mt_2 fz_20 fb">
					{{dataInfo.pointBalance||0}}积分
				</view>
				<view class="mt_2 fz_12">
					{{dataInfo.waitReceiptPoints||0}}积分待到账
				</view>
			</view>
			<button v-if="showRecord" class="custom_btn fz_12 lh_33 plr_12 br_30"
				style="background: linear-gradient(180deg, #FFE4BF 0%, #FFFFFF 100%);color: #A5640C;" @click="handleTransform">转化金豆</button>
		</view>
		<view class="mt_12 br_8 flow_h">
			<navigator class="bc_fff fc_666 p_12 fx aic jcb" hover-class="none" url="/pages/person/pages/record?type=point">
				积分明细
				<u-icon name="arrow-right" color="#ccc" size="32rpx"></u-icon>
			</navigator>
			<navigator v-if="showRecord" class="bc_fff fc_666 p_12 fx aic jcb" hover-class="none" url="/pages/person/pages/record?type=pointTransform">
				转化明细
				<u-icon name="arrow-right" color="#ccc" size="32rpx"></u-icon>
			</navigator>
		</view>
	</view>
</template>

<script>
	import api from '@/service/config/api'
	export default {
		data() {
			return {
				dataInfo: {},
				showRecord: false
			}
		},
		onShow() {
			this.getData()
			if(this.$store.state.appType == this.$base.USER_TYPE) {
				this.showRecord = true
			}
		},
		methods: {
			getData() {
				this.$utils.loading()
				api.get('/user/api/myScoring').then(res => {
					this.dataInfo = res.data
				})
			},
			handleTransform() {
				uni.navigateTo({
					url: '/pages/person/pages/mission'
				})
			}
		},
	}
</script>

<style lang="scss">
	.container {}
</style>